import React from 'react';
import ReactDOM from 'react-dom';
function creatDiv (id) {
    let div = document.createElement('div')
    div.setAttribute('id', id)
    return div
}
export function renderAppById (pageId, App) {
    setTimeout(() => {
        let appDom = document.querySelector(`#${pageId}`)
        if (appDom) {
            ReactDOM.unmountComponentAtNode(appDom)
            appDom.remove()
        }
        let div = creatDiv(pageId)
        document.querySelector('body').appendChild(div)
        ReactDOM.render(<App />, div);
    },200) 
}